package demo02;

import java.util.ArrayList;

//定义方法，集合打印出来的效果是[100,200,300]
//要求打印出来的是{100@200@300}
public class HomeWork06 {
    public static void main(String[] args){
        ArrayList<Integer> list = new ArrayList<Integer> ();
        list.add(100);
        list.add(200);
        list.add(300);
        System.out.println("原来的集合:"+list);
        newArrayList(list);
    }

    private static void newArrayList(ArrayList<Integer> list) {
        int[] num = new int[3];
        System.out.print("新的集合:"+"{");
        for(int i=0;i<3;i++){
            num[i] = list.get(i);
            if (i == 2){
                System.out.print(num[i]+"}");
                break;
            }
            System.out.print(num[i]+"@");
        }
    }
}